/*
 *    Copyright (c) 2018-2025, boss All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the boss developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: boss
 */

package com.hopes.bizz.hazard.enterprises.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hopes.bizz.common.core.util.DateUtils;
import com.hopes.bizz.hazard.common.constant.enums.HazardSysDictEnum;
import com.hopes.boss.admin.api.resolver.DictResolver;
import com.hopes.boss.admin.api.resolver.enums.AdminDictEnum;
import com.hopes.boss.common.entity.BaseLogicEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;

/**
 * 企业实时风险
 *
 * @author daijie
 * @date 2024-01-30 17:20:20
 */
@Data
@TableName("haz_enterprises_rt")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "企业实时风险")
public class HazEnterprisesRtEntity extends BaseLogicEntity {

    private static final long serialVersionUID = 1L;


    /**
     * 标识
     */
    @TableId(type = IdType.ASSIGN_ID)
    @Schema(description = "标识")
    private Long id;

    /**
     * 当前风险
     */
    @Schema(description = "当前风险")
    private String riskLevel;

    /**
     * 平均扰动率
     */
    @Schema(description = "平均扰动率")
    private Integer disturbanceRateAvg;

    /**
     * 重复报警点位数
     */
    @Schema(description = "重复报警点位数")
    private Integer repeatedAlarmPoints;

    /**
     * 点位平均报警次数
     */
    @Schema(description = "点位平均报警次数")
    private Integer alarmPointAvg;

    /**
     * 平均报警时长
     */
    @Schema(description = "平均报警时长")
    private Integer alarmDurationAvg;

    /**
     * 报警处置及时率
     */
    @Schema(description = "报警处置及时率")
    private Integer alarmHandlingRate;

    /**
     * 更新时间
     */
    @Schema(description = "更新时间")
    private Date dateTime;

    /**
     * 机构ID
     */
    @Schema(description = "机构ID")
    private Long orgId;

    public String getDateTimeStr() {
        return DateUtils.limitMinute(this.dateTime);
    }

    public String getOrgIdStr() {
        return DictResolver.getItemLabelByValue(AdminDictEnum.sys_company, this.getOrgId());
    }

    public String getRiskLevelStr() {
        return DictResolver.getItemLabelByValue(HazardSysDictEnum.hazard_enterprises_risk_level, this.riskLevel);
    }

    public String getDisturbanceRateAvgStr() {
        return this.disturbanceRateAvg + "%";
    }

    public String getAlarmPointAvgStr() {
        return this.alarmPointAvg + "%";
    }

    public String getAlarmDurationAvgStr() {
        return this.alarmDurationAvg + "分钟";
    }

    public String getAlarmHandlingRateStr() {
        return this.alarmHandlingRate + "%";
    }

}